<template name="workflowMenuByFlow">
	<ul class="nav sidebar-menu workflow-menu-by-flow">
		<li class="header header-app">
			{{_ "Steedos Workflow"}}
		</li>
		<li class="inbox {{boxActive 'inbox'}}">
			<a href="{{urlPrefix}}/workflow/space/{{spaceId}}/inbox/">
				<i class="ion ion-archive"></i>
				<span>{{_ "inbox"}}</span>
				<span class="pull-right-container">
					<span class="label pull-right bg-red">{{_getBadge "workflow" getSpaceId}}</span>
				</span>
			</a>
			{{#if hasInbox}}
			<ul class="treeview-menu menu-open" style="display: block;">
	
				{{#each categorys}}
	
				{{#with inboxCategory this._id}}
				{{#if hasInstances this.inbox_count}}
				<li class="workflow-category {{#if (equals Session_category _id)}}active{{/if}}">
					<a href="{{urlPrefix}}/workflow/space/{{spaceId}}/inbox/">
						<span class="category-name text-overflow">{{name}}</span>
					</a>
					<ul class="treeview-menu">
						{{#each this.inboxInstancesFlow}}
						<li class="{{#if (equals selected_flow _id)}}active{{/if}}">
							<a class="inbox-flow text-overflow" href="{{urlPrefix}}/workflow/space/{{space}}/inbox"
								undefined="">
								<!--<i class="ion ion-clipboard"></i>-->
								<span class="flow-name text-overflow">{{name}}</span>
								<span class="pull-right-container">
									<span class="label pull-right bg-red">{{inbox_count}}</span>
								</span>
							</a>
						</li>
						{{/each}}
					</ul>
				</li>
				{{/if}}
				{{/with}}
				{{/each}}
	
				{{#with inboxCategory}}
				{{#if hasInstances this.inbox_count}}
				<li class="workflow-category {{#if (equals Session_category '-1')}}active{{/if}}">
					<a href="{{urlPrefix}}/workflow/space/{{spaceId}}/inbox/">
						<span class="category-name text-overflow">{{_ "workflow_no_category"}}</span>
					</a>
					<ul class="treeview-menu">
						{{#each this.inboxInstancesFlow}}
						<li class="{{#if (equals selected_flow _id)}}active{{/if}}">
							<a class="inbox-flow text-overflow" href="{{urlPrefix}}/workflow/space/{{space}}/inbox"
								undefined="">
								<!--<i class="ion ion-clipboard"></i>-->
								<span class="flow-name text-overflow">{{name}}</span>
								<span class="pull-right-container">
									<span class="label pull-right bg-red">{{inbox_count}}</span>
								</span>
							</a>
						</li>
						{{/each}}
					</ul>
				</li>
				{{/if}}
				{{/with}}
			</ul>
			{{/if}}
		</li>
	
	
		<li class="outbox {{boxActive 'outbox'}}">
			<a href="{{urlPrefix}}/workflow/space/{{spaceId}}/outbox/">
				<i class="ion ion-android-done-all"></i>
				<span>{{_ "outbox"}}</span>
			</a>
		</li>
	
	
				<li class="draft {{boxActive 'draft'}}">
					<a href="{{urlPrefix}}/workflow/space/{{spaceId}}/draft/"> <i
							class="ion ion-compose"></i><span>{{_ "draft"}}</span>
						<span class="pull-right-container">
							{{#if draftCount}}
							<span class="label pull-right bg-special">{{draftCount}}</span>
							{{/if}}
						</span>
					</a>
				</li>
				<li class="pending {{boxActive 'pending'}}">
					<a href="{{urlPrefix}}/workflow/space/{{spaceId}}/pending/">
						<i class="ion ion-ios-loop"></i>
						<span>{{_ "pending"}}</span>
					</a>
				</li>
				<li class="completed {{boxActive 'completed'}}">
					<a href="{{urlPrefix}}/workflow/space/{{spaceId}}/completed/">
						<i class="ion ion-android-checkbox-outline"></i>
						<span>{{_ "completed"}}</span>
					</a>
				</li>

		{{#if isShowMonitorBox}}
		<li class="monitor {{boxActive 'monitor'}}">
			<a href="{{urlPrefix}}/workflow/space/{{spaceId}}/monitor/">
				<i class="ion ion-eye"></i>
				<span>{{_ "monitor"}}</span>
			</a>
		</li>
		{{/if}}
		
		{{#if showOthenInbox inboxSpaces}}
		<li class="header">
			<!-- {{_ "workflow_more_inbox"}} -->
		</li>
		{{#each inboxSpaces}}
		<li class="other-inbox">
			<a href="{{urlPrefix}}/workflow/space/{{this.space}}/inbox/">
				<i class="ion ion-archive"></i>
				<span class="text-overflow box-space-name">{{spaceName this.space}}</span>
				<span class="pull-right-container">
					<span class="label pull-right bg-red">{{getBadge "workflow" this.space}}</span>
				</span>
			</a>
		</li>
		{{/each}}
		{{/if}}
	</ul>
</template>